package com.ggk911.pharmacy_system.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ggk911.pharmacy_system.entity.DrugInfoType;
import com.ggk911.pharmacy_system.mapper.DrugInfoTypeMapper;
import com.ggk911.pharmacy_system.service.IDrugInfoTypeSercice;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ggk-911
 * @version 1.0 2023/3/19 18:37
 */
@Service
public class DrugInfoTypeServiceImpl extends ServiceImpl<DrugInfoTypeMapper, DrugInfoType> implements IDrugInfoTypeSercice {
    /**
     * 重写的page方法
     *
     * @param page
     * @param queryWrapper
     * @param <E>
     * @return
     */
    @Override
    public <E extends IPage<DrugInfoType>> E page(E page, Wrapper<DrugInfoType> queryWrapper) {
        return baseMapper.selectPage(page, queryWrapper);
    }

    /**
     * 重写的list方法
     *
     * @param queryWrapper
     * @return
     */
    @Override
    public List<DrugInfoType> list(Wrapper<DrugInfoType> queryWrapper) {
        return baseMapper.selectList(queryWrapper);
    }

    /**
     * getIdByName
     *
     * @return
     */
    public int getIdByName(String name) {
        return baseMapper.getDrugInfoTypeIdByDrugInfoTypeName(name);
    }
}
